<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('thumb_id')  ->default(0)    ->comment('课程封面');
            $table->string('name')          ->default('')   ->comment('课程名');
            $table->string('desc')          ->default('')   ->comment('简介');
            $table->decimal('price')        ->default(0)    ->comment('价格');
            $table->decimal('integral')     ->default(0)    ->comment('兑换积分');
            $table->string('study_type')    ->default('')    ->comment('学习形式：online线上,come到场');
            $table->string('address')       ->default('')   ->comment('授课地址');
            $table->text('introduce')       ->nullable()   ->comment('课程介绍');
            $table->bigInteger('teacher_id')->default(0)   ->comment('讲课老师id');
            $table->tinyInteger('is_featured')->default(0)   ->comment('是否精品');
            $table->integer('sort')         ->default(0)   ->comment('排序');
            $table->tinyInteger('need_check_in')->default(0)   ->comment('需要签到');
            $table->tinyInteger('check_per_day')->default(0)   ->comment('每天签到次数');
            $table->integer('check_in_integral')     ->default(0)   ->comment('签到积分');
            $table->tinyInteger('status')   ->default(0)   ->comment('状态');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::dropIfExists('courses');
    }
}
